package jobhistory

import (
	"github.com/gin-gonic/gin"
	"openeuler.org/PilotGo/PilotGo-plugin-automation/internal/module/job_history/controller"
)

func JobHistoryHandler(router *gin.RouterGroup) {
	api := router.Group("/jobs")
	{
		api.POST("/execute", controller.ExecJob)
		api.GET("/list", controller.GetJobs)
		api.GET("/list/:job_id", controller.GetJobByJobId)
		api.GET("/result/:job_id", controller.GetJobResultByJobId)
		api.GET("/result/:job_id/:ip", controller.GetSubJobResultByJobId)
		api.POST("/resume", controller.ResumeManualJob)
		api.POST("/retry", controller.RetryJob)
		api.GET("/related/:job_id", controller.GetRelatedJobs) // 获取关联任务
		api.GET("/chain/:job_id", controller.GetRetryChain)    // 获取完整重试链
	}
}
